fs lege carpe hauri
Translation status: 简体中文 reader-locale proof. Term names and code fences follow the zh-Hans pack; supporting prose may still be English.
fs file reads are shape-specific: 读取<文本>, carpe (列表<文本>), hauri (字节).
Syntax: charta.read_file<文本>(经由) | call 'solum:carpe' (经由) ↦ 列表<文本> | call 'solum:hauri' (经由) ↦ 字节
Category#
ad
Related#
Examples#
radix/corpus/ad/solum-lege-generic.fab (canonical · concept)#
fs file reads are shape-specific: 读取<文本>, carpe (列表<文本>), hauri (字节).
# =============================================================================
# 仅 读取 carpe hauri — 仅 file reads are shape-specific routes.
# =============================================================================
#
# What this teaches:
# • Shape-specific reads — `charta.read_file<文本>` reads a file as text;
# `solum:carpe` reads it as a line list; `solum:hauri` reads raw bytes
# • Manifest-backed surface — each route declares exactly one result shape in
# the 仅 provider manifest, so the materialized target always matches
#
# Common mistakes:
# • assuming one generic `charta.read_file<T>` reads every shape — `读取` is
# text-only; use `carpe` for `列表<文本>` and `hauri` for `字节`
#
# See also: 调用, 仅, 读取, carpe, hauri
# =============================================================================
# 仅 file reads — 读取 (text) / carpe (lines) / hauri (bytes)
#
# The provider contract (hosts/crates/solum manifest) keeps one result shape
# per route: `solum:lege` → 文本, `solum:carpe` → 列表<文本>,
# `solum:hauri` → 字节. The `norma:fs` wrappers `carpe`/`hauri` are
# module-private this release, so this fixture reaches the line/byte routes
# directly through the manifest-backed `调用` surface; the compiler's
# `@ radix 类型` metadata on `norma:charta.read_file<T>` still admits the broader
# targets, which the provider rejects (recorded residual). Generic
# `charta.read_file<T>` across all three shapes is separate future provider work.
#
# Runtime check: files are prepared under /tmp so each read route can prove its
# accepted result shape independently of the harness working directory.
import from "norma:fs" charta
main {
const string textPath ← "/tmp/faber-fs-lege-generic.txt"
charta.write_file(textPath, "prima\nsecunda\n")
const string body ← charta.read_file<string>(textPath)
assert body ≡ "prima\nsecunda\n"
const list<string> lineae ← call 'solum:carpe' (textPath) ↦ list<string>
assert lineae ≡ (["prima", "secunda"] ↦ list<string>)
const bytes data ← call 'solum:hauri' (textPath) ↦ bytes
assert data ≡ |70 72 69 6d 61 0a 73 65 63 75 6e 64 61 0a|
print body
print lineae
print data
print "fs lege carpe hauri parata"
}Expected output:
prima
secunda
["prima", "secunda"]
[112, 114, 105, 109, 97, 10, 115, 101, 99, 117, 110, 100, 97, 10]
fs lege carpe hauri parata